/**
 * 
 */
package team.helpmephone.app.common;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * Copyright (c) 2010 LG-Nortel, Inc. All Rights Reserved.
 * 
 * CONFIDENTIALITY AND LIMITED USE: This software, including any software of <br>
 * third parties embodied herein, contains code, information, data and concepts <br>
 * which are confidential and/or proprietary to LG-Nortel and such third <br>
 * parties. This software is licensed for use solely in accordance with the <br>
 * terms and conditions of the applicable license agreement with LG-Nortel or <br>
 * its authorized distributor, and not for any other use or purpose. No <br>
 * redistribution of this software by any party is permitted. <br>
 * 
 * Title: HelpMePhoneOpenHelper.java<br>
 * Description: <br>
 * Copyright: Copyright(c) 2010 LG-NORTEL ALL Rights Reserved<br>
 * Company: LG-Nortel<br>
 * 
 * @author Jonghwa, Lee
 * @version 1.0
 * @created 2010. 3. 4.
 * @modified 2010. 3. 4.
 * @product EFA R4.0 EMS
 * @sw_block Client Block
 */
public class HelpMePhoneOpenHelper extends SQLiteOpenHelper {
	
	private static final String DATABASE_NAME = "HelpMePhone.db";
	private static final int DATABASE_VERSION = 1;

	/**
	 * @param context
	 * @param name
	 * @param factory
	 * @param version
	 */
	public HelpMePhoneOpenHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.database.sqlite.SQLiteOpenHelper#onCreate(android.database.sqlite.SQLiteDatabase)
	 */
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE " + DaoHelpMePhone.TABLE_NAME_HELP_ME_PHONE + " (_id INTEGER PRIMARY KEY, " + DaoHelpMePhone.COLUMN_ACTIVITY_NAME + " TEXT, " + DaoHelpMePhone.COLUMN_ACTIVITY_VALUE + " TEXT);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.w(getClass().getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data");
		db.execSQL("DROP TABLE IF EXISTS " + DaoHelpMePhone.TABLE_NAME_HELP_ME_PHONE);
		onCreate(db);
	}
}